#ifndef _DSWVIDEOSVR_H
#define _DSWVIDEOSVR_H

#include "tcpserverbase.h"
#include <libtcpcombase/dswvideosession.h>

class CDswvideosvr : public CTcpserverbase
{
public:
	CDswvideosvr(LPST_ENV_T pEnv, int nPort);
	virtual ~CDswvideosvr();
private:
	virtual void OnAccept(evutil_socket_t fd, struct sockaddr *address, int socklen);

	static void cbSessionNotifyFunc(LPST_SESSION_NOTIFY_T pParam, void* pCaller){((CDswvideosvr*)pCaller)->SessionNotifyFunc(pParam);};
	void SessionNotifyFunc(LPST_SESSION_NOTIFY_T pParam);

	void LocalTransFunc(LPST_LOCAL_TRANS_T pLocalTransParam, char* pData, int nLen);

public:
	static void cbLocalTransFunc(void* pLocalTransParam, char* pData, int nLen, void* pCaller){((CDswvideosvr*)pCaller)->LocalTransFunc((LPST_LOCAL_TRANS_T)pLocalTransParam, pData, nLen);};
	void SetPlaybackPos(LPST_PLAYBACK_NODE_T pNode);
	void SetPlaybackSpeed(LPST_PLAYBACK_NODE_T pNode);
	void RemoveSessionNode(char* pPucId);
	void SetDiskStatus(ENM_HD_STATUS nStatus);
private:
	HashTable* m_pClientTable;
	pthread_mutex_t m_nLock;

	HashTable* m_pExternalCams;
	pthread_mutex_t m_nExtCamsLock;
};

#endif

